onCallback

abstract fun onCallback(args: Array<String>)

Invoked when a registered generic callback event occurs.

The content and structure of the args array are defined by the component or script that initiated the callback. Developers should consult the documentation of the event-dispatching component (e.g., a specific Gadget's API) to understand the expected arguments for different callback events.

Conventionally, args[0] might represent the name of the command or event, with subsequent elements providing parameters. For example:


// Example: A callback from a gadget to trigger a native action
// args[0] = "navigateToScreen"
// args[1] = "screenId_123"

// Example: A callback reporting a user interaction
// args[0] = "userClickedButton"
// args[1] = "submitOrderButton"
// args[2] = "item_ABC" (optional data)

Implementers should be prepared to handle a variable number of arguments and perform necessary validation or type conversion on the string arguments.

Parameters

args

An array of String arguments passed by the callback event's source. The meaning and order of these arguments are specific to the particular callback event. Can be an empty array if no arguments are provided, but typically should not be null.